using AdminSG3L.Applicaticn.Commands;
using AdminSG3L.Applicaticn.Dtos;
using AdminSG3L.Domain.Entities;

namespace AdminSG3L.Applicaticn.ServicesInterface;

/// <summary>
/// 认证服务接口，提供登录、注册、忘记密码等功能
/// </summary>
public interface IAuthService
{
    /// <summary>
    /// 用户登录
    /// </summary>
    /// <param name="dto">登录参数（用户名、密码等）</param>
    /// <returns>登录结果（如Token等）</returns>
    Task<ApiResponse<TokenResponseDto>> LoginAsync(LoginDto dto);

    /// <summary>
    /// 用户注册
    /// </summary>
    /// <param name="dto">注册参数（用户名、手机号、验证码、密码等）</param>
    /// <returns>注册结果（如Token、提示信息等）</returns>
    Task<ApiResponse<TokenResponseDto>> RegisterAsync(RegisterDto dto);

    /// <summary>
    /// 忘记密码身份验证（用户名、手机号、短信验证码）
    /// </summary>
    /// <param name="dto">身份验证参数</param>
    /// <returns>验证结果</returns>
    Task<ApiResponse<bool>> VerifyIdentityAsync(ForgotPasswordVerifyDto dto);

    /// <summary>
    /// 忘记密码用户验证（仅用户名、邮箱）
    /// </summary>
    /// <param name="dto">用户验证参数</param>
    /// <returns>验证结果</returns>
    Task<ApiResponse<bool>> VerifyUserAsync(ForgotPasswordVerifyUserDto dto);

    /// <summary>
    /// 重置密码（只需新密码）
    /// </summary>
    /// <param name="dto">重置密码参数</param>
    /// <returns>重置结果</returns>
    Task<ApiResponse<bool>> ResetPasswordAsync(ResetPasswordDto dto);

    /// <summary>
    /// 刷新JWT Token
    /// </summary>
    /// <param name="dto">刷新Token参数</param>
    /// <returns>新的Token对</returns>
    Task<ApiResponse<TokenResponseDto>> RefreshTokenAsync(RefreshTokenDto dto);

    /// <summary>
    /// 吊销RefreshToken（登出/失效）
    /// </summary>
    /// <param name="refreshToken">要吊销的RefreshToken</param>
    /// <returns>操作结果</returns>
    Task<ApiResponse<bool>> RevokeRefreshTokenAsync(string refreshToken);

    /// <summary>
    /// 根据用户ID获取用户信息
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>用户信息</returns>
    Task<AppUser?> GetUserByIdAsync(Guid userId);

    /// <summary>
    /// 更新用户资料
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="dto">更新资料DTO</param>
    /// <returns>更新结果</returns>
    Task<ApiResponse<UserProfileDto>> UpdateProfileAsync(string userId, UpdateProfileDto dto);

    /// <summary>
    /// 修改密码
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="dto">修改密码DTO</param>
    /// <returns>修改结果</returns>
    Task<ApiResponse<object>> ChangePasswordAsync(string userId, ChangePasswordDto dto);

    /// <summary>
    /// 更新头像
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="avatarUrl">头像URL</param>
    /// <returns>更新结果</returns>
    Task<ApiResponse<object>> UpdateAvatarAsync(string userId, string avatarUrl);
}